// 书写品管管理模块中的接口
import request from "@/utils/request";
import {
  TradeMark,
  TradeMarkResponseData,
} from "@/api/product/trademark/type.ts";

// url列表
enum API {
  // 获取品牌列表
  TRADEMARK_URL = "/admin/product/baseTrademark/{page}/{limit}",
  ADD_TRADEMARK_URL = "/admin/product/baseTrademark/save",
  UPDATE_TRADEMARK_URL = "/admin/product/baseTrademark/update",
  DELETE_TRADEMARK_URL = "/admin/product/baseTrademark/remove/{id}",
}

// 获取品牌列表
export const reqGetTrademarkList = (page: number, limit: number) =>
  request.get<any, TradeMarkResponseData>(
    API.TRADEMARK_URL.replace("{page}", page.toString()).replace(
      "{limit}",
      limit.toString(),
    ),
  );

// /admin/product/baseTrademark/save POST 新增BaseTrademark
export const reqAddTrademark = (data: TradeMark) =>
  request.post<any, any>(API.ADD_TRADEMARK_URL, data);

// PUT /admin/product/baseTrademark/update
// 修改BaseTrademark
export const reqUpdateTrademark = (data: TradeMark) =>
  request.put<any, any>(API.UPDATE_TRADEMARK_URL, data);

// 删除 /admin/product/baseTrademark/remove/{id} DELETE 删除BaseTrademark
export const reqDeleteTrademark = (id: number) =>
  request.delete<any, any>(
    API.DELETE_TRADEMARK_URL.replace("{id}", id.toString()),
  );
